package com.company.test3;

public class GirlFriend {
    // 对于私有变量来说， 假设我们不直接更改成员属性，可以将成员方法暴露出去，然后去修改
    private String name;
    private int age;
    private String gender;

    public void setName(String name){
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setAge(int age) {
        if (age <= 50 && age >= 18) {
            this.age = age;
        } else {
            System.out.println("Invalid age");
        }
    }

    public int getAge() {
        return age;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getGender() {
        return gender;
    }
}
